<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>数组的应用</title>
<script type="text/javascript">
	var fruit=new Array(5);
	fruit[0]="Apple";
	fruit[1]="Orange";
	fruit[2]="Banner";
	fruit[3]="Peach";
	fruit[4]="Grape";
	document.write("<h3>输出数组：</h3>");
	for(var i=0;i<fruit.length;i++)
	{
		document.write("<h5>第"+i+"个元素是："+fruit[i]+"<br/></h5>");
	}
	document.write("<h3>反转后的数组：</h3>");
	fruit.reverse();
	for(var i=0;i<fruit.length;i++)
	{
		document.write("<h5>第"+i+"个元素是："+fruit[i]+"<br/></h5>");
	}
	document.write("<h3>排序后的数组：</h3>");
	fruit.sort();
	for(var i in fruit)
	{
		document.write("<h5>第"+i+"个元素是："+fruit[i]+"<br/></h5>");
	}
	document.write("<h3>使用连接符连接数组：</h3>")
	var str=fruit.join("-");
	document.write(str);
</script>
</head>

<body>
</body>
</html>
